package com.young.springdemo.service.mediator;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

//@Component
public class testMediator {

//    @PostConstruct
    public void testMedia() {
        //定义中介者对象
        SubConcreateMediator mediator = new SubConcreateMediator();

        //定义同事类
        List list = new List();
        ComboBox comboBox = new ComboBox();
        TextBox textBox = new TextBox();
        Button button = new Button();
        Label label = new Label();

        button.setMediator(mediator);
        list.setMediator(mediator);
        textBox.setMediator(mediator);
        comboBox.setMediator(mediator);
        label.setMediator(mediator);

        mediator.button = button;
        mediator.list=list;
        mediator.textBox =textBox;
        mediator.comboBox = comboBox;
        mediator.label=label;

        button.changed();
        System.out.println("==============");
        list.changed();
        System.out.println("=========");
        comboBox.changed();
    }
}
